#!/bin/sh -x

NEWFILES=`svn status | egrep '^(A|M)' | awk '{print $NF}'`
DELFILES=`svn status | egrep '^D' | awk '{print $NF}'`

USER=caiche
HOST=sqws114.houston.hp.com
HOME=/opt/home/$USER
BRANCH=dicp-M9

rm -rf RPMS
mkdir -p RPMS/noarch

ssh $USER@$HOST "cd $HOME/$BRANCH/pearl; svn update"
for file in $DELFILES
do
    ssh $FILES $USER@$HOST rm $HOME/$BRANCH/pearl/$file
done

for file in $NEWFILES
do
    scp $file $USER@$HOST:$HOME/$BRANCH/pearl/$file
done

ssh $USER@$HOST "cd $HOME/$BRANCH/pearl; make clean; make"
scp $USER@$HOST:$HOME/$BRANCH/pearl/RPMS/noarch/*.rpm RPMS/noarch

